package com.adam.springbucks.aop;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * 全局异常处理类
 */

@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(value = BucksException.class)
    public ResTypeBean businessExceptionHandler(BucksException e) throws  Exception{
        return new ResTypeBean<>(e.getErrCode(), e.getMessage());
    }
}